package thread;


import com.ms.common.utils.ThreadUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * @author ganbo
 * @date 2022/10/18 18:17
 */

@Slf4j
public class JoinDemo {

    static int r = 0;

    public static void main(String[] args) throws InterruptedException {
        test1();
    }

    private static void test1() throws InterruptedException {
        log.debug("开始");
        Thread t1 = new Thread(() -> {
            log.debug("开始");
            ThreadUtils.sleepSeconds(1);
            log.debug("结束");
            r = 10;
        });
        t1.start();
        t1.join();
        log.debug("结果为:{}", r);
        log.debug("结束");
    }


}
